Skip to main content

Thanos

INTRODUCTION: - Thanos is an open-source extension to Prometheus created by Improbable, a British gaming technology company. In their blog post announcing the release of Thanos, Improbable revealed the project's goal: "to seamlessly transform existing Prometheus deployments in clusters around the world into a unified monitoring system with unbounded historical data storage."

What is Prometheus?

In short, Prometheus is a system monitoring and alerting toolkit. People use Prometheus to monitor various kinds of workloads, from their application to the infrastructure the application is deployed on. Prometheus was initially created with more focus on real-time monitoring, with data retention requirements in order of a few months.

Thanos was created to address these limitations. With Thanos, you can have a highly available Prometheus setup, with unlimited retention of data. It allows you to store the metrics generated by Prometheus in object storage of your choice. It also allows you to have a global view of metrics from all the Prometheus instances.

  • By adding Thanos to Prometheus, users can build highly available metric systems with practically unlimited storage. When deployed, Thanos provides features such as a global query view, high accessibility (HA), and affordable access to historical data in a single binary.

The various components of the Thanos project are as follows:

  • Thanos Sidecar:  The main component of Thanos that runs alongside Prometheus, reading and archiving data on the object store. Sidecar can also execute PromQL queries.
  • Thanos Store:  An API gateway that sits on top of historical Prometheus data in an object storage bucket. 
  • Thanos Query:  An aggregator for query results from multiple sources, multiple Sidecar instances.
  • Thanos Compact:  A component that applies Prometheus 2.0's compaction procedure to block data in object store.
  • Thanos Ruler:  A component that evaluates the Prometheus recording and alerting rules against your choice of query API.

Building

Thanos is built purely in Golang, thus allowing to run Thanos on various x64 operating systems.

If you want to build Thanos from source you would need a working installation of the Go 1.16+ toolchain 

Thanos can be downloaded and built by running:

go get github.com/thanos-io/thanos/cmd/thanos

The thanos binary should now be in your $PATH and is the only thing required to deploy any of its components.

Integrations StoreAPI

StoreAPI is a common proto interface for gRPC component that can connect to Querier in order to fetch the metric series. Natively Thanos implements Sidecar (local Prometheus data), Ruler and Store gateway. This solves fetching series from Prometheus or Prometheus TSDB format, however same interface can be used to fetch metrics from other storages.

Deploying Thanos